#include "StunSlider.h"

StunSlider::StunSlider(QWidget * parent)
	:QSlider(parent)
{
	AddCss();
}
StunSlider::StunSlider(Qt::Orientation orientation, QWidget * parent)
	:QSlider(orientation,parent)
{
	AddCss();
}

void StunSlider::AddCss()
{
    QString css = "QSlider"
				  "{"

				  "}"
				  "QSlider:vertical "
				  "{"
				  "		width : 45px;"
				  "}"
				  "QSlider::groove:vertical"
				  "{"
                  "		position: absolute;" /* absolutely position 4px from the left and right of the widget. setting margins on the widget should work too... */
				  "		left: 4px; right: 4px;"
				  "		border: 0px solid #42748F;"
                  "}"
				  //Bouton non pressé
                  "QSlider::handle:vertical "
				  "{"
                  " 	background: qlineargradient(x1:0, y1:0, x2:0, y2:1, "
                  "    	stop:0 #DFDFDF, stop: 0.5 #7E7E7E, stop:1 #BCBCBC);"
                  "  	border: 2px solid #42748F;"
                  " 	border-radius: 6px;"
                  "  	height: 40px;"
				  "		margin: 0 -4px;"
                  "} "
				  //Bouton pressé
				  "QSlider::handle:pressed "
				  "{"
                  "  	background: qlineargradient(x1:0, y1:0, x2:0, y2:1, "
                  "    	stop:0 #DFDFDF, stop: 0.5 #7E7E7E, stop:1 #BCBCBC);"
                  "  	border: 2px solid #00FFFF;"
                  "  	border-radius: 6px;"
                  "}"			  
				  //Bar recouverte
                  "QSlider::add-page:vertical "
				  "{"
                  " 	background: qlineargradient(x1:0, y1:0, x2:0.8, y2:0,"
				  "    	stop:0 #FFFFFF, stop:1 #00A2C1);"
				  "		border: 1px solid rgb(75,75,75);"
				  "		border-radius: 6px;"
                  "}"
				  //Bar découverte
                  "QSlider::sub-page:vertical "
				  "{"
                  "  	background: qlineargradient(x1:0, y1:0, x2:1, y2:0, "
                  "    	stop: 0 #CCD5CC, stop:1 #004776);"
				  "		border: 1px solid rgb(75,75,75);"
				  "		border-radius: 6px;"
                  "}"
				  
				  "QSlider:horizontal "
				  "{"
				  "		height : 45px;"
				  "}"
				  "QSlider::groove:horizontal"
				  "{"
                  "		position: absolute;" /* absolutely position 4px from the left and right of the widget. setting margins on the widget should work too... */
				  "		top: 4px; bottom: 4px;"
				  "		border: 0px solid #42748F;"
                  "}"
				  //Bouton non pressé
                  "QSlider::handle:horizontal "
				  "{"
                  " 	background: qlineargradient(x1:0, y1:0, x2:0, y2:1, "
                  "    	stop:0 #DFDFDF, stop: 0.5 #7E7E7E, stop:1 #BCBCBC);"
                  "  	border: 2px solid #42748F;"
                  " 	border-radius: 6px;"
                  "  	width: 40px;"
				  "		margin: -4 0px;"
                  "} "
				//Bouton pressé
				"QSlider::handle:pressed"
				"{"
				  "  	background: qlineargradient(x1:0, y1:0, x2:0, y2:1, "
				  "    	stop:0 #DFDFDF, stop: 0.5 #7E7E7E, stop:1 #BCBCBC);"
				  "  	border: 2px solid #00FFFF;"
				  "  	border-radius: 6px;"
				  "}"		  
				  //Bar recouverte
                  "QSlider::add-page:horizontal "
				  "{"
                  "  	background: qlineargradient(x1:1, y1:0, x2:1, y2:1, "
                  "    	stop: 0 #CCD5CC, stop:1 #004776);"
				  "		border: 1px solid rgb(75,75,75);"
				  "		border-radius: 6px;"
                  "}"
				  //Bar découverte
                  "QSlider::sub-page:horizontal "
				  "{"
                  " 	background: qlineargradient(x1:1, y1:0, x2:0.8, y2:1,"
				  "    	stop:0 #FFFFFF, stop:1 #00A2C1);"
				  "		border: 1px solid rgb(75,75,75);"
				  "		border-radius: 6px;"
                  "}";
    this->setStyleSheet(css);
}